import request from '@/plugins/request';

export function AccountLogin(data: Record<string, any>) {
  const defaultParams = {
    randomStr: new Date().getTime(),
    code: 9999,
    grant_type: 'password',
    type: '1',
    scope: 'server',
  };
  return request({
    url: '/api/a/login',
    method: 'post',
    headers: {
      // Authorization: 'Basic ZmFybTpmYXJt',
      'x-requested-with': 'XMLHttpRequest',
      'x-ajax': 'json',
      'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
    },
    params: {
      ...data,
      // ...defaultParams,
    },
  });
}
//注册
export function AccountRegister(data: Record<string, any>) {
  return request({
    url: '/api/admin/register',
    method: 'post',
    data,
  });
}
//获取用户基本信息
export function getPersonalUserInfo(data: Record<string, any>) {
  return request({
    url: '/api/admin/personalUser/info',
    method: 'get',
    params: data,
  });
}

//获取用户基本信息
export function putUpdateInfo(data: Record<string, any>) {
  return request({
    url: '/api/admin/personalUser/updateInfo',
    method: 'put',
    data,
  });
}

//获取用户权限标识
export function getPersonalAuth() {
  return request({
    url: '/api/a/authInfo',
    method: 'get',
  });
}
